﻿using System;
using System.Collections.Generic;
using System.Reflection;

namespace Facebook
{
    public class FacebookController
    {
        public FacebookController(IFacebookContext facebookContext)
        {
            this.FacebookContext = facebookContext;
        }

        protected IFacebookContext FacebookContext { get; private set; }

        protected IAsyncResult BeginExecuteRequest(String methodName, IDictionary<String, Object> args, AsyncCallback callback)
        {
            return this.FacebookContext.BeginExecuteRequest(methodName, args, callback);
        }

        protected FacebookResponse<TValue> EndExecuteResponse<TValue>(IAsyncResult result, String responseXmlRoot)
        {
            return this.FacebookContext.EndExecuteRequest<TValue>(result, responseXmlRoot);
        }

        protected FacebookResponse<TValue> ExecuteRequest<TValue>(String methodName)
        {
            return this.FacebookContext.ExecuteRequest<TValue>(methodName, null, null);
        }

        protected FacebookResponse<TValue> ExecuteRequest<TValue>(String methodName, String responseXmlRoot)
        {
            return this.FacebookContext.ExecuteRequest<TValue>(methodName, null, responseXmlRoot);
        }

        protected FacebookResponse<TValue> ExecuteRequest<TValue>(String methodName, IDictionary<String, Object> args)
        {
            return this.FacebookContext.ExecuteRequest<TValue>(methodName, args, null);
        }

        protected FacebookResponse<TValue> ExecuteRequest<TValue>(String methodName, IDictionary<String, Object> args, String responseXmlRoot)
        {
            return this.FacebookContext.ExecuteRequest<TValue>(methodName, args, responseXmlRoot);
        }
    }
}